/**
 * *****************************************************************
 * @file    adt3102_uart.h
 * @author  WuHao(hwu@andartechs.com.cn)
 * @version 1.0.0
 * @date    2020-11-24
 * @brief   
 *                 Copyright (c) 2020, Andar Technologies Inc.
 *                           www.andartechs.com 
 *
 * *****************************************************************
 */
#ifndef __UART_H
#define __UART_H
/*------------------------------ include -------------------------------------*/
#include "adt3102_type_define.h"
#include "uart_ctype_map.h"


/*------------------------------ function ------------------------------------*/
/**
 * @brief   uart0 and uart1 and uart2 setting.
 * @param   UartX: Uart number:UART0,UART1,UART2.
 * @param   baudRate: .
 * @param   highClock50M: .
 * @return  None.
 * @note
 */
void uartInit(UartTypeDef *UartX, uint32 baudRate, int32 highClock50M);
void assert_failed(uint8* file, uint32 line);

/**
 * @brief   uart send specified byte data.
 * @param   UartX: Uart number:UART0,UART1,UART2.
 * @param   sendBuff: uart buffered data ready to send.
 * @param   sendLen: The length of the buffer data uart is ready to send.
 * @return  len uart has sent the length of the data .
 * @note
 */
int32 uartWrite(UartTypeDef *UartX,const uint8 *sendBuff, int32 sendLen);

/**
 * @brief   uart receive specified byte data.
 * @param   UartX: Uart number:UART0,UART1,UART2.
 * @param   recvBuff: uart buffered data ready to receive.
 * @param   recvLen: The length of the buffer data uart is ready to receive.
 * @return  len uart has receive the length of the data .
 * @note
 */
int32 uartRead(UartTypeDef *UartX,uint8 *recvBuff, int32 recvLen);

/**
 * @brief   uart0 and uart1 and uart2 setting.
 * @param   format: printf standard format.
 * @return  None.
 * @note
 */
int16 printfDebug(const char *format, ...);

/**
 * @brief   uart0 and uart1 and uart2 printf.
 * @param   UartX: Uart number:UART0,UART1,UART2.
 * @param   format: printf standard format.
 * @return  None.
 * @note
 */
void printfUart(UartTypeDef *UartX,const char *format, ...);

/**
 * @brief   get uart rx ready flag.
 * @param   None.
 * @return  uint8. uart rx ready flag value
 * @note
 */
uint8 getUartRxReadyFlag(void);

/**
 * @brief   set uart rx ready flag.
 * @param   uint8. uart rx ready flag value
 * @return  None.
 * @note
 */
void  setUartRxReadyFlag(uint8 value);

#endif
